/**
 * 功能描述 行编辑触发事件
 */
define(function (require, exports, module) {
	var store = require("store");
	var activeUser = store.get("user");
    module.exports = {
        setTotal : function(component, widget){
        	var datas = component.getData();
        	var payable = 0;
        	for (var i = 0;i<datas.length;i++){
        		payable = payable + Number(datas[i].payable);
        	}
        	widget.get("form").setValue("totalAmount", payable.toFixed(2));
        },
        fillingData : function(index, rowData, component){
        	if(rowData.operator){
        		rowData.operator.pkUser = activeUser.pkUser;
        		rowData.operator.name = activeUser.name;
        	}else{
        		rowData.operator = {
        				pkUser : activeUser.pkUser,
        				name : activeUser.name
        		}
        	}
        	rowData.chargeDate = moment().format("YYYY-MM-DD");
        	component.update(index, rowData);
        }
    };
});
